package ipad.asia.service.impl;

import ipad.asia.dao.EvaluateDao;
import ipad.asia.entity.Evaluate;
import ipad.asia.service.EvaluateService;
import ipad.asia.utils.MyTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;
@Service
public class EvaluateServiceImpl implements EvaluateService {
    @Autowired
    private EvaluateDao evaluateDao;
//    @Override
//    public List<Evaluate> findByConsumerId(int consumerId) {
//        return evaluateDao.findByConsumerId(consumerId);
//    }

    @Override
    public List<Evaluate> findByShopId(int shopId) {
        return evaluateDao.findByShopId(shopId);
    }

    @Override
    public Evaluate findById(int id) {
        return evaluateDao.findById(id);
    }

//    @Override
//    public void launch(int consumerId, int shopId,int productId ,String content,Integer level, LocalDateTime date) {
//        Evaluate evaluate=new Evaluate();
//        evaluate.setConsumerId(consumerId).setShopId(shopId).setContent(content)
//                .setLevel(level).setDate(new MyTime().LocalDateTime()).setProductId(productId);
//        evaluateDao.save(evaluate);
//    }
//
//    @Override
//    public boolean update(int id, String content, Integer level, LocalDateTime date,Integer chance) {
//        Evaluate evaluate =evaluateDao.findById(id);
//        if(evaluate.getChance()==null){
//        evaluate.setId(id).setContent(content).setLevel(level).
//                setDate(new MyTime().LocalDateTime()).setChance(1);
//        evaluateDao.save(evaluate);return true;}else{return false;}
//    }

}
